/*
  CoveWhsFs
  Copyright (C) 2011 Alex Piskarev  
  http://code.google.com/p/covewhsfs/
  
  Original work:
  Dokan
  Copyright (C) 2010 Hiroki Asakawa info@dokan-dev.net
  http://dokan-dev.net/en

This program is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your option) any
later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along
with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include "sys.h"

#ifdef ALLOC_PRAGMA
#pragma alloc_text (PAGE, DokanDispatchQueryEa)
#pragma alloc_text (PAGE, DokanDispatchSetEa)
#endif

NTSTATUS
DokanDispatchQueryEa (
    IN PDEVICE_OBJECT VolumeDeviceObject,
    IN PIRP Irp
    )

/*++

Routine Description:

    This routine implements the Fsd part of the NtQueryEa API
    call.

Arguments:

    VolumeDeviceObject - Supplies the volume device object where the file
        being queried exists.

    Irp - Supplies the Irp being processed.

Return Value:

    NTSTATUS - The FSD status for the Irp.

--*/

{
    NTSTATUS Status;
    PIO_STACK_LOCATION irpSp;
    
    PAGED_CODE();

    //
    //  Call the common query routine, with blocking allowed if synchronous
    //

    FsRtlEnterFileSystem();
    
    irpSp = IoGetCurrentIrpStackLocation(Irp);
    
    DDbgPrintEnterRequest("DokanQueryEa", irpSp);
    
    try {

        Status = STATUS_NOT_SUPPORTED;

    } except(DokanExceptionFilter( GetExceptionInformation() )) {

        //
        //  We had some trouble trying to perform the requested
        //  operation, so we'll abort the I/O request with
        //  the error status that we get back from the
        //  execption code
        //

        Status = GetExceptionCode();
    }

    Irp->IoStatus.Status = Status;
    Irp->IoStatus.Information = 0;
    
    DokanPrintNTStatus(Status);
    DDbgPrintExitRequest("DokanQueryEa", irpSp);
    
    IoCompleteRequest(Irp, IO_NO_INCREMENT);
            
    FsRtlExitFileSystem();

    //
    //  And return to our caller
    //

    UNREFERENCED_PARAMETER( VolumeDeviceObject );

    return Status;

}

NTSTATUS
DokanDispatchSetEa (
    IN PDEVICE_OBJECT VolumeDeviceObject,
    IN PIRP Irp
    )

/*++

Routine Description:

    This routine implements the FSD part of the NtSetEa API
    call.

Arguments:

    VolumeDeviceObject - Supplies the volume device object where the file
        being set exists.

    Irp - Supplies the Irp being processed.

Return Value:

    NTSTATUS - The FSD status for the Irp.

--*/

{
    NTSTATUS Status;
    PIO_STACK_LOCATION irpSp;

    PAGED_CODE();

    //
    //  Call the common set routine, with blocking allowed if synchronous
    //

    FsRtlEnterFileSystem();

    irpSp = IoGetCurrentIrpStackLocation(Irp);
    
    DDbgPrintEnterRequest("DokanSetEa", irpSp);
    
    try {

        Status = STATUS_NOT_SUPPORTED;

    } except(DokanExceptionFilter( GetExceptionInformation() )) {

        //
        //  We had some trouble trying to perform the requested
        //  operation, so we'll abort the I/O request with
        //  the error status that we get back from the
        //  execption code
        //

        Status = GetExceptionCode();
    }

    Irp->IoStatus.Status = Status;
    Irp->IoStatus.Information = 0;
    
    DokanPrintNTStatus(Status);
    DDbgPrintExitRequest("DokanSetEa", irpSp);
    
    IoCompleteRequest(Irp, IO_NO_INCREMENT);
    
    FsRtlExitFileSystem();

    //
    //  And return to our caller
    //

    UNREFERENCED_PARAMETER( VolumeDeviceObject );

    return Status;
}